/*
    This file is part of p4f
    Copyright (C) 2009  Sebastian Lezama

    p4f is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as 
    published by the Free Software Foundation, either version 3 of the 
    License, or (at your option) any later version.

    p4f is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
*/

#ifndef _FTP_H_
#define _FTP_H_

#include <socket.h>
#include <string>

#define RECVBUFFER 1024    //SendCommand
#define READBUFFER 256     //Files
#define RECV ""

class FTPClient{
public:	
	FTPClient();
	~FTPClient();
	bool connect(std::string host, int port, std::string user, std::string pass);
	bool UploadFile(std::string localpath, std::string remotepath);
	bool DownloadFile(std::string remotepath, std::string localpath);		
protected:	
	Net n;
	TcpSocket s;
	bool isConnected;
	std::string response;
	std::string error;
	std::string SendCommand(std::string command, std::string value);
	void GetIPandPort(const std::string &data, std::string &ip, int &port);
	bool SendFile(std::ifstream &inFile, std::string &remotepath, std::string &IpPort);
	bool GetFile(std::ofstream &outFile, std::string &remotepath, std::string &IpPort);
};


class FTPServer{


};


#endif /* _FTP_H_ */
